<template>
  <div class="touch">
    <div v-show="isTouch" class="istouch">
      <div class="title mb10">设置触达人</div>
      <div>
        <el-input size="small" class="mb10" placeholder="搜索" />
        <div class="scroll mb10">
          <div v-for="(item, index) in touchList" :key="index">
            <div class="mb10 letter">{{ item.first_letter }}</div>
            <div
              v-for="(etm, j) in item.user_list"
              :key="j"
              class="mb10 content"
            >
              <!-- <div>{{ etm.realname }} {{ etm.structure_name }}</div>
              <span>{{ etm.mobile }}</span> -->
              <el-radio-group v-model="touchId" @change="options">
                <el-radio :label="etm.id" class="content_touch">
                  <div>
                    <p class="mb10">
                      {{ etm.realname }}
                      <span class="department ml10">{{
                        etm.structure_name
                      }}</span>
                    </p>
                    <span class="c999">{{ etm.mobile }}</span>
                  </div>
                </el-radio>
              </el-radio-group>
            </div>
          </div>
        </div>
        <div class="right_letter">
          <ul v-for="(itm, i) in touchList" :key="i">
            <li>{{ itm.first_letter }}</li>
          </ul>
        </div>
        <div class="footer">
          <el-button
            size="small"
            class="mr20"
            type="info"
            @click="cancel"
          >取消</el-button>
          <el-button
            size="small"
            class="mr20"
            type="success"
            @click="determine"
          >确定</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// import pinyin from '../../../node_modules/js-pinyin/index';
export default {
  name: 'Conversion',
  props: {
    isTouch: {
      type: Boolean,
      default: false
    },
    touchList: {
      type: Array,
      default: () => []
    },
    touchId: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {};
  },
  mounted() {},
  methods: {
    cancel() {
      this.$emit('abolish');
    },
    determine() {
      this.$emit('determine', this.touchId);
    },
    options() {
        this.$emit('optionsRadio', this.touchId);
    }
  }
};
</script>

<style lang="scss" scoped>
.touch {
  .istouch {
    position: absolute;
    right: 10%;
    top: 2%;
    border: 1px solid #dcdfe6;
    width: 400px;
    padding: 10px;
    z-index: 99;
    background: #fff;
    height: 540px;
    overflow: hidden;
    .title {
      font-weight: bolder;
      text-align: center;
    }
    .scroll {
      height: calc(500px - 90px);
      overflow: auto;
      .content {
        border-top: 1px solid #dcdfe6;
        border-bottom: 1px solid #dcdfe6;
        .content_touch {
          width: 360px;
          display: flex;
          align-items: center;
          padding: 10px 0;
        }
      }
      .department {
        display: inline-block;
        border: 1px solid #5680ff;
        padding: 5px;
        border-radius: 20px;
        color: #5680ff;
        font-size: 12px;
      }
    }
    .footer {
      display: flex;
      justify-content: end;
    }
    .right_letter {
      position: fixed;
      right: 164px;
      top: 206px;
      li {
        padding: 2px 0;
        font-size: 14px;
      }
    }
  }
}
</style>
